#include <iostream>
using namespace std;

int main() {
    int l = 0, r = 0;
    cin >> l >> r;
    int ret = 0;
    for (int i = l; i <= r; i++)
    {
        int num = i;
        while (num)
        {
            int tmp = num % 10;
            num /= 10;
            if (tmp == 2)
            {
                ret++;
            }
        }
    }
    cout << ret;
}